<?php session_start() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once "statics.php";
if (isset($_SESSION['email']) && isset($_SESSION['password'])) {
    echo"<script type='text/javascript'>top.window.location='main.php';</script>";
    exit();
} else if (isset($_COOKIE['cookemail']) && isset($_COOKIE['cookpass'])) {
    $_SESSION['email'] = $_COOKIE['cookemail'];
    $_SESSION['password'] = $_COOKIE['cookpass'];
    $rsMember = rsSelect("member_id", "member", array("email=", $_SESSION['email']));
    if (is_string($rsMember))
        echo $rsMember;
    else {
        if (mysql_num_rows($rsMember) == 1) {
            $row = mysql_fetch_assoc($rsMember);
            $_SESSION['member_id'] = $row['member_id'];
            echo"<script type='text/javascript'>top.window.location='main.php';</script>";
            exit();
        }
    }
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <link rel="shortcut icon" type="image/x-icon" href="menu icons/favicon.ico"/>
        <link href="style3.css" rel="stylesheet" type="text/css" />
        <title></title>
    </head>
    <body>
        <select id="lang" class="float_left">
            <optgroup label="Language">
                <option value="en">English</option>
            </optgroup>
        </select>
        <br/>
        <br/>
        <br/>
        <br/>
        <span>
            <?php
//session_start();
            if (isset($_SESSION['lang'])) {
                require_once "./language_files/index_" . $_SESSION['lang'] . ".php";
                echo "<input type='hidden' id='lang_value' value='{$_SESSION['lang']}'/>";
            } else {
                require_once "./language_files/index_en.php";
                echo "<input type='hidden' id='lang_value' value='en'/>";
            }
            ?>
            <input type="hidden" id="new_user" value="<?php if (isset($_GET['user'])) echo $_GET['user'];else echo 'null'; ?>"/>
        </span>
        <div align="center"><img src="ConfO-logo.png" alt="ConfO logo" /></div>
        <p>
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
        </p>

        <? // all of these like prssing enter inorder to make it in the middle of the page     ?>
        <table style="border-radius: 0px; border: 2px #003366 solid; width: 100%; background-color: #003366;">
            <tr>
                <td style="text-align: center; border: 0;"><input id="start" class="index"  type="button" value="<?php echo $lang['conf']; ?>"/></td>
                <td style="text-align: center; border: 0;"><input id="signin" class="index" type="button" value="<?php echo $lang['sign_in']; ?>"/></td>
                <td style="text-align: center; border: 0;"><input class="index" id="signup" type="button" value="<?php echo $lang['sign_up']; ?>"/></td>
            </tr>
        </table>
        <div id="cover4">
        </div>
        <iframe class="sign_in" id="start_conference" name="start_conference" scrolling="no" style="width: 550px; height: 210px;">
            </iframe>
        <div id="cover5">
        </div>
        <iframe id="sign_in" name="sign_in" class="sign_in" scrolling="no" style="width: 550px; height: 210px;">
            </iframe>
        <div id="cover6">
        </div>
        <iframe class="sign_up" name="sign_up" scrolling="no" style="width: 800px; height: 525px;">
            </iframe>
        <?php
        require 'footer.php';
// the function that calls the footer page.
        ?>
        <?php include "jquery.php"; ?>
        <script type="text/javascript" src="functions.js"></script>
        <link href="jqueryui-all.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="jqueryui-tabs.js"></script>
        <script type="text/javascript">
            //<![CDATA[
            $(document).ready(function(){
                $(".footer-index").css("top", $(window).height()-15);
                $(".sign_in").css("top", ($(window).height()/2)-200);
                $(".sign_in").css("left", ($(window).width()/2)-300);
                $(".sign_up").css("left", ($(window).width()/2)-400);
                $(".sign_up").css("top", ($(window).height()/2)-270);
                $("#warning").css("left", ($(window).width()/2)-320);
                $("#warning").css("top", ($(window).height()/2)-280);
                
                
$("#lang option[value="+$("#lang_value").val()+"]").attr("selected", "selected");
$("#lang").bind("change",function()
{
    $.ajax({
        type:"GET",
        url:"detectLanguage.php",
        data:{lang:$(this).val()},
        success:function(response)
        {
            window.location.href=window.location.href;
        }
    });
});
if($("#new_user").val()!="null")
{
    $("iframe[name=sign_in]").attr("src", "signIn2.php?user="+$("#new_user").val());
    $("#cover5").fadeIn('slow');
    $("#sign_in").fadeIn('slow');
}
$("#signin").click(function(){
    $("iframe[name=sign_in]").attr("src", "signIn2.php");
    $("#cover5").fadeIn('slow');
    $("#sign_in").fadeIn('slow');
});
$("#start").click(function(){
    $("iframe[name=start_conference]").attr("src", "signIn2.php?val=1");
    $("#cover4").fadeIn('slow');
    $("#start_conference").fadeIn('slow');
});
$("#signup").click(function(){
    $("iframe[name=sign_up]").attr("src", "signUp2.php");
    $("#cover6").fadeIn('slow');
    $(".sign_up").fadeIn('slow');
});
});
//]]>
        </script>
    </body>
</html>